package com.ww.disruptor.factory;

import java.util.concurrent.ThreadFactory;

public class CustomizableThreadFactory implements ThreadFactory {

    private final String threadNamePre;

    public CustomizableThreadFactory(String threadNamePre) {
        this.threadNamePre = threadNamePre;
    }

    @Override
    public Thread newThread(Runnable r) {
        Thread thread = new Thread(r);
        thread.setName(threadNamePre + thread.getName());
        return thread;
    }
}
